From 37e9f9f3b5e302236aaf8b23d5cc1ce20eee40f6 Mon Sep 17 00:00:00 2001 From: "emellor@leeni.uk.xensource.com" Date: Sat, 26 Nov 2005 01:08:26 +0000 Subject: [PATCH] Fix the 06_block-list_checkremove test. The use of string.find was invalid (should be testing against -1, not merely using if or if not), one block-list command was missing, and the block-detach command is asynchronous (to give the domain time to close down the device) so we need a time.sleep(1) call before trying xm block-list. Signed-off-by: Ewan Mellor --- .../06_block-list_checkremove_pos.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tools/xm-test/tests/block-list/06_block-list_checkremove_pos.py b/tools/xm-test/tests/block-list/06_block-list_checkremove_pos.py index 14956fc5c4..ccaf0d72cc 100644 --- a/tools/xm-test/tests/block-list/06_block-list_checkremove_pos.py +++ b/tools/xm-test/tests/block-list/06_block-list_checkremove_pos.py @@ -30,7 +30,7 @@ if s != 0: s, o = traceCommand("xm block-list %s" % domain.getName()) if s != 0: FAIL("block-list failed") -if not o.find("769"): +if o.find("769") == -1: FAIL("block-list didn't show the block device I just attached!") s, o = traceCommand("xm block-attach %s phy:/dev/ram1 hda2 w" % domain.getName()) @@ -40,25 +40,31 @@ if s != 0: s, o = traceCommand("xm block-list %s" % domain.getName()) if s != 0: FAIL("block-list failed") -if not o.find("770"): +if o.find("770") == -1: FAIL("block-list didn't show the other block device I just attached!") s, o = traceCommand("xm block-detach %s 769" % domain.getName()) if s != 0: - FAIL("block-destroy of hda1 failed") + FAIL("block-detach of hda1 failed") +time.sleep(1) s, o = traceCommand("xm block-list %s" % domain.getName()) if s != 0: FAIL("block-list failed after detaching a device") -if o.find("769"): +if o.find("769") != -1: FAIL("hda1 still shown in block-list after detach!") -if not o.find("770"): +if o.find("770") == -1: FAIL("hda2 not shown after detach of hda1!") s, o = traceCommand("xm block-detach %s 770" % domain.getName()) +if s != 0: + FAIL("block-detach of hda2 failed") + +time.sleep(1) +s, o = traceCommand("xm block-list %s" % domain.getName()) if s != 0: FAIL("block-list failed after detaching another device") -if o.find("770"): +if o.find("770") != -1: FAIL("hda2 still shown in block-list after detach!") if o: FAIL("block-list still shows something after all devices detached!") -- 2.30.2